package cn.neusoft.controller;

import cn.neusoft.pojo.Food;
import cn.neusoft.query.FoodQuery;
import cn.neusoft.service.IFoodService;
import cn.neusoft.vo.ResultBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "餐品的API",description="餐品相关的CRUD功能")
//@CrossOrigin   通过该注解我们完成允许跨域的设置   还可以通过配置类的方式来进行设置
@RestController
@RequestMapping("/food")
public class FoodController extends BaseController<Food,FoodQuery>{

    @Autowired
    IFoodService foodService;

    @ApiOperation(value = "通过商家id查询餐品信息")
    @GetMapping("/getByBId/{bid}")
    public ResultBean getByBusinessId(@PathVariable("bid") Integer businessId){
        System.out.println("-----FoodController------getByBusinessId------");
        System.out.println(businessId);
       return foodService.getByBusinessId(businessId);
    }

}
